home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
amiga
/
fractal
/
fcloud.arc
/
cloud.doc
< prev
next >
Wrap
Text File
|
1989-11-05
|
4KB
|
84 lines
***************************************************************
***************************************************************
Welcome to FractalCloud!
***************************************************************
***************************************************************
I have always been interested in fractals, especially
fractal mountains. I had been searching the world over for
easily coded routines to generating them, but I usually
ran up into a big brick wall, that is, until I found the
wonderful book "The Science of Fractal Images" by Heinz-Otto
Peitgen and Dietmar Saupe (Springer-Verlag, New York, 1988).
They give actual pseudo-code, which makes my job a lot easier.
What is my job? Well, as a neophyte Amiga programmer, I
at first just wanted to get a program done. But then a higher
calling said "Help Others!" so I decided to post my program,
plus something people to learn, my code. The theory behind the
code is not too complex.
Essentially a grid of 2^N x 2^N (I use N=7) is at zero. The
grid is divided into quarters and the vertices are raised or
lowered a fractal (based upon the Gaussian distribution) amount.
These quarters are then split up into quarters (sixteenths of
the original) and the vertices are adjusted again. This process
is then repeated N times, until each vertex has been changed.
Then, the relative "height" (for lack of a better term) is
used to determine a color (with all below a certain amount pure
blue) that is then displayed. Simple. Of course, there is the
Amiga Intuition Routines around all this, which was actually
the hard part.
This archive is made up of:
cloud : The executable
cloud.c : The source code
cloud.doc : This file
Gauss_sup.c : The Gaussian support routines
S_sup.c : The screen support routines
W_sup.c : The window support routines
I_sup.c : The Intuition support routines
The last three are straight from "The Waite Group's Inside
the Amiga with C," by John Thomas Berry (Howard W. Sams & Company,
Indianapolis, 1988)
To use cloud, there is one optional argument, H, which is
3-D, where D is defined as the Fractal Dimension. H must be
greater than 0 and less than 1, that is 0 < H < 1. If no
argument or an invalid argument is given, H defaults to 0.5.
A good value is 0.3 < H < 0.5.
This code compilies under Lattice C 5.02, but I see no
reason why it shouldn't under Manx. No special options are
needed, just compile and link cloud.c and all the _sup.c
routines and run. Easy!
Of course, I am not responsible for any havoc this program
may cause. It is freeware, just put it anywhere you feel
like. I want everybody to learn.
In the future: This routine is slow... and not to flexible.
I want to convert it to a routine using and inverse FFT, but
I don't have the code for one. That will allow leaving the
2^N by 2^N size restriction on the array behind so I can use
the whole screen. Also, there is no stopping me from using
these "heights" as 3-d data to model fractal mountains. I know
the algorithms for ray tracing, so maybe that too is in the
future. Of course, no promises are made, but I'll try.
So, try them you'll like them. I also have sundry other
routines that generate fractal motion in 1-dimension, if anyone
wants them, ask. If you want to get in contact with me, try GEnie,
@ P.MACCGOVERN. Also, you can send me a Inverse FFT routine.
Also US Mail:
Phil MacGovern
3433 1st ave.
San Diego, CA,
92103.
Have fun.